"ctags -R --c++-kinds=+p --fields=+iaS --extra=+q -f tag-5 E:\develop\Core_Libs

let fn=expand('%:p')
let fl=getfsize(fn)
if 0==fl || (-1==fl && 1==line('$') && 0==get(getbufline('.', '$'), 0))
	set fenc=utf-8 "bomb/nobomb
	let sExt=expand('%:e')
	if sExt=~?"h.*"
		call hexing#c_hx#HX_header_file()
	endif
endif

if exists("b:ft_c_hx") | finish | endif
let b:ft_c_hx=1

"functions {{{1
	function! <SID>CppFoldText()
		return (v:foldstart - v:foldend) . ' lines foldlevel: ' . v:foldlevel . ' ' . getline(v:foldstart)
	endfunction

if !exists("g:ft_C")
	let g:ft_C = 1
	set guioptions-=T guioptions-=r guioptions-=l guioptions+=h guioptions-=m guioptions-=R guioptions-=b guioptions-=L
endif


"setting {{{1
	"setlocal completefunc=hexing#hexing_autoload#HX_cpp_user_complete
	setl ar 
	setl cino+=)6 cino+=:0 cino+=(0 cino+=g0 cino-=:0
	setl cpt=.,t
	setl fdm=syntax fdl=9
	"setl mp=make
	setl fo-=cro

	setl fdt=<SID>CppFoldText()
"map {{{1
	nn <buffer> <silent> <F7> :call hexing#c_hx#HX_make('')<CR>
	nn <buffer> <silent> <F5> :call hexing#c_hx#HX_make('run=1')<CR>
	nn <buffer> <silent> <C-F7> :call hexing#c_hx#HX_syntax_check()<CR>
	nn <buffer> <silent> <F3> :AT<CR>
	"nn <buffer> <silent> <F3> :call hexing#c_hx#HX_switch_h_cpp()<CR>
	nn <buffer> <silent> <F8> :TagbarToggle<CR>
	nn <buffer> <silent> <A-t> :tnext<CR>
	nn <buffer> <silent> <A-h> :call hexing#c_hx#HX_header_file()<CR>
	"nn <buffer> <silent> gf :tabedit <cfile><CR>
	nn <buffer> <silent> gf :call hexing#c_hx#HX_gf()<CR>
	nn <buffer> <silent> ; :call setline('.', getline('.').';')<CR>

	"ino <buffer> <silent> <CR> <C-R>=pumvisible() ? "\<lt>C-Y>\<lt>C-R>=hexing#hexing_autoload#HX_setion_complete()\<lt>CR>" :  "\<lt>C-R>=hexing#c_hx#HX_keymap_Enter()\<lt>CR>"<CR>
	ino <buffer> <silent> <A-u> <C-R>=hexing#hexing_autoload#HX_popup_setion_completion('*')<CR>
	"ino <buffer> <silent> <Esc> <C-R>=hexing#c_hx#HX_keymap_Escape()<CR>
	im <buffer> <silent> <F7> <Esc><F7>
	im <buffer> <silent> <F5> <Esc><F5>
	im <buffer> <silent> <C-F7> <Esc><C-F7>
	"ino <buffer> <silent> { <C-R>=hexing#c_hx#HX_keymap_Dkh()<CR>
	"ino <buffer> <silent> : <C-R>=hexing#c_hx#HX_keymap_Colon()<CR>

	vn <buffer> <silent> <kDivide><kMultiply> :call hexing#c_hx#HX_comment_c()<CR>

"iabbr {{{1
	"iabbr <buffer> <silent>  if if ()<Left>
	iabbr <buffer> <silent>  #i #include
	iabbr <buffer> <silent>  #d #define
	iabbr <buffer> <silent>  #f #ifdef<CR>#endif<Up><End>
	iabbr <buffer> <silent>  #n #ifndef<CR>#endif<Up><End>
	iabbr <buffer> <silent> tchar TCHAR
	inorea <buffer> <silent>  _ _("")<Left><Left>
	inorea <buffer> <silent>  _t _T("")<Left><Left>

"Popup menu {{{1
	" nnoremenu 0.01 PopUp.Cpp/H :AT<CR>
	" nnoremenu 0.02 PopUp.TlistToggle :TlistToggle<CR>
	" nnoremenu 0.09 PopUp.-SEP0-	<Nop>
